package com.yswee.mallnavi.view.screensaver;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.yswee.framework.utils.ViewInject;
import com.yswee.framework.widget.layoutview.MRelativeLayout;
import com.yswee.mallnavi.R;
import com.yswee.mallnavi.entity.common.AdsEntity;

public class AdsItem extends MRelativeLayout<AdsEntity> {

    @ViewInject
    private ImageView imgpicture;
    @ViewInject
    private TextView tvtitle;

    public AdsItem(Context context) {
        super(context);
    }

    public AdsItem(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    protected int getLayoutResId() {
        return R.layout.view_screensaver_adsitem;
    }

    @Override
    protected void onBindListener() {
        super.onBindListener();
        View.OnClickListener onclick = new View.OnClickListener() {
            @Override
            public void onClick(View v) {

            }
        };
        imgpicture.setOnClickListener(onclick);
        setOnClickListener(onclick);
    }

    @Override
    protected void onApplyData() {
        Glide.with(this)
                .load(mDataItem.pic)
                .into(imgpicture);
        tvtitle.setText(mDataItem.name);
    }

}
